package me.ydq.core.sql;

import me.ydq.core.SqlSpec;
import me.ydq.misc.Fn;

import java.util.function.Supplier;

public interface SqlNotLike<T> {

    SqlSpec<T> notLike(Fn<T, ?> fn, String value);

    SqlSpec<T> notLike(String column, String value);

    default SqlSpec<T> notLike(Supplier<Boolean> condition, Fn<T, ?> fn, Supplier<String> valGet) {
        return notLike(Boolean.TRUE.equals(condition.get()), fn, valGet);
    }

    default SqlSpec<T> notLike(Supplier<Boolean> condition, Fn<T, ?> fn, String val) {
        return notLike(Boolean.TRUE.equals(condition.get()), fn, val);
    }

    default SqlSpec<T> notLike(boolean condition, Fn<T, ?> fn, Supplier<String> valGet) {
        return condition ? notLike(fn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notLike(boolean condition, Fn<T, ?> fn, String val) {
        return condition ? notLike(fn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notLike(Fn<T, ?> fn, Supplier<String> valGet) {
        return notLike(fn, valGet.get());
    }

    default SqlSpec<T> notLike(Supplier<Boolean> condition, String rawColumn, Supplier<String> valGet) {
        return notLike(Boolean.TRUE.equals(condition.get()), rawColumn, valGet);
    }

    default SqlSpec<T> notLike(Supplier<Boolean> condition, String rawColumn, String val) {
        return notLike(Boolean.TRUE.equals(condition.get()), rawColumn, val);
    }

    default SqlSpec<T> notLike(boolean condition, String rawColumn, Supplier<String> valGet) {
        return condition ? notLike(rawColumn, valGet.get()) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notLike(boolean condition, String rawColumn, String val) {
        return condition ? notLike(rawColumn, val) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notLike(String rawColumn, Supplier<String> valGet) {
        return notLike(rawColumn, valGet.get());
    }

}
